package com.zzzs.threaddemo;

/**
 * @author zhu_shuai
 * @since 2021/6/22
 */
public class RunableDemo {
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            System.out.println(i);
            MyRunable myRunable = new MyRunable(i);
            new Thread(myRunable).start();
        }
    }
}

class MyRunable implements Runnable{

    private int i;

    public MyRunable() {
    }

    public MyRunable(int i) {
        this.i = i;
    }

    @Override
    public void run() {
        System.out.println("id: " + i);
    }
}